﻿using Microsoft.Xna.Framework;

namespace Babylon.Primitives
{
    /// <summary>
    /// Colored ellipse
    /// </summary>
    public class ColoredEllipse : EllipseBase<VertexPositionNormalColor>
    {
        readonly Color _color;

        /// <summary>
        /// Create an instance of ColoredEllipse
        /// </summary>
        /// <param name="verticalRay">vertical ray size</param>
        /// <param name="horizontalRay">horizontal ray size</param>
        /// <param name="verticalSubdivisions">number of vertical subdivisions (should be > 1)</param>
        /// <param name="color">color of the ellipse</param>
        public ColoredEllipse(float verticalRay, float horizontalRay, int verticalSubdivisions, Color color)
            :base(verticalRay, horizontalRay, verticalSubdivisions)
        {
            _color = color;
        }
        protected override void BeforeCreatingVertices(float horizontalRay, float verticalRay, int subdivisions)
        {
        }

        protected override void AfterCreatingVertex(ref VertexPositionNormalColor vertex, float normalizedZRot, float normalizedYRot)
        {
            vertex.Color = _color;
        }

        protected override VertexPositionNormalColor CreateVertex()
        {
            return new VertexPositionNormalColor();
        }

        protected override Microsoft.Xna.Framework.Graphics.VertexDeclaration GetVertexDeclaration()
        {
            return VertexPositionNormalColor.GetVertexDeclaration();
        }
    }
}
